/*
* 1videoConference -- An open source video conferencing platform.
*
* Copyright (C) 2007 - 2008, Adiance Technologies Pvt. Ltd.
*
* Hardik Sanghvi <hardik.sanghvi @adiance.com>
*
* See http://www.1videoconference.org for more information about
* the 1videoConference project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, forums and mailing lists
* for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/

using System;
using System.Windows;
using System.Windows.Navigation;
using System.Data;
using System.Xml;
using System.Configuration;
using System.Collections;
using System.Deployment.Application;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.ServiceModel;
using _videoConference.BAL;

namespace _videoConference
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>

    public partial class App : System.Windows.Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            try
            {
                UserInfo.Initialize();                
                //PeerServices.OpenChannels();
            }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "1videoConference--:--App.xaml.cs--:--OnStartup()--:----:--");
                clsUtility.LogException = exp;
                //MessageBox.Show("1videoConference--:--App.xaml.cs--:--OnStartup()--:--" + exp.Message);
            }
        }

        protected override void OnExit(ExitEventArgs e)
        {
            base.OnExit(e);
         
            try
            {
                if (UserInfo.strMeetingMode == "Meeting Mode")
                {
                    if (PeerServices.channelPageNav.State == CommunicationState.Opened)
                    {
                        PeerServices.channelPageNav.Close();
                    }
                    if (PeerServices.channelPodResize.State == CommunicationState.Opened)
                    {
                        PeerServices.channelPodResize.Close();
                    }
                }
            }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "1videoConference--:--App.xaml.cs--:--OnExit()--:----:--");
                clsUtility.LogException = exp;
                //MessageBox.Show("1videoConference--:--App.xaml.cs--:--OnExit()--:--" + exp.Message);
            }
        }

    }
}
